﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Child : RelationBase
    {
        private static Child _singleton = new Child();
        public static Child Instance
        {
            get { return _singleton; }
        }

        private Child() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's Child IFF a is b's mother or father
            return a == b.Mother || a == b.Father;
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>( new IRelation[] {Mother.Instance, Father.Instance} );
        }
    }
}
